(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 8.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       157,          7]
NotebookDataLength[     10518,        270]
NotebookOptionsPosition[      9765,        242]
NotebookOutlinePosition[     10129,        258]
CellTagsIndexPosition[     10086,        255]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{

Cell[CellGroupData[{
Cell[BoxData[
 RowBox[{"SetDirectory", "[", 
  RowBox[{"NotebookDirectory", "[", "]"}], "]"}]], "Input",
 CellChangeTimes->{{3.543144814647977*^9, 3.5431448217343826`*^9}, {
  3.543148464177718*^9, 3.543148495908533*^9}, {3.5445270370838356`*^9, 
  3.5445270516316676`*^9}, {3.5445271787629395`*^9, 3.544527184599273*^9}}],

Cell[BoxData[
 FormBox["\<\"C:\\\\Users\\\\rsinnet\\\\Documents\\\\MATLAB\\\\meen-652-biped\
\\\\code\"\>", TraditionalForm]], "Output",
 CellChangeTimes->{3.5445271850632997`*^9}]
}, Open  ]],

Cell[BoxData[{
 RowBox[{"<<", "Linearize.m"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"<<", "vectorfields.eqn"}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"<<", "outputs.eqn"}], ";"}]}], "Input",
 CellChangeTimes->{{3.543144768769353*^9, 3.543144794434821*^9}, {
  3.5431448309389095`*^9, 3.5431448723462777`*^9}, {3.5431459315008574`*^9, 
  3.5431459324789133`*^9}, {3.543146168373406*^9, 3.5431461747407703`*^9}, {
  3.5433383453308544`*^9, 3.5433383459198875`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"ndof", "=", "5"}], ";"}]], "Input",
 CellChangeTimes->{{3.5431449040640917`*^9, 3.5431449064022255`*^9}, {
  3.543145062525155*^9, 3.5431450627961707`*^9}}],

Cell[BoxData[{
 RowBox[{
  RowBox[{"xi", "=", 
   RowBox[{"Flatten", "[", 
    RowBox[{"Import", "[", "\"\<xk.mat\>\"", "]"}], "]"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"qi", "=", 
   RowBox[{"xi", "\[LeftDoubleBracket]", 
    RowBox[{"1", ";;", "ndof"}], "\[RightDoubleBracket]"}]}], ";"}]}], "Input",
 CellChangeTimes->{{3.5431469073456726`*^9, 3.543146925496711*^9}, {
   3.5431469691862097`*^9, 3.5431469841250644`*^9}, 3.543148471630145*^9, {
   3.543149845309715*^9, 3.5431498530591583`*^9}, {3.5433354583257265`*^9, 
   3.5433354585297384`*^9}, {3.5433372460219774`*^9, 
   3.5433372488551393`*^9}, {3.543338329885971*^9, 3.5433383406185846`*^9}, {
   3.543338568259605*^9, 3.543338569697687*^9}, 3.544526329306353*^9, {
   3.5445269901631517`*^9, 3.5445269908391905`*^9}}],

Cell[BoxData[{
 RowBox[{
  RowBox[{"q", "=", 
   RowBox[{"Table", "[", 
    RowBox[{
     RowBox[{"{", 
      RowBox[{
       SubscriptBox["\[Theta]", "i"], "[", "t", "]"}], "}"}], ",", 
     RowBox[{"{", 
      RowBox[{"i", ",", "1", ",", "ndof"}], "}"}]}], "]"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"dq", "=", 
   RowBox[{"D", "[", 
    RowBox[{"q", ",", "t"}], "]"}]}], ";"}]}], "Input",
 CellChangeTimes->{{3.504391169851249*^9, 3.504391191970865*^9}, {
   3.5129535326917257`*^9, 3.5129535355376797`*^9}, 3.513011937181409*^9, {
   3.513012138013254*^9, 3.513012139016991*^9}, 3.515858456069166*^9, {
   3.5158695182095623`*^9, 3.515869519316625*^9}, {3.543144895029575*^9, 
   3.543144895308591*^9}, {3.5445272763305197`*^9, 3.544527280900781*^9}}],

Cell[BoxData[{
 RowBox[{
  RowBox[{"\[Chi]", "=", 
   RowBox[{"Join", "[", 
    RowBox[{"q", ",", "dq"}], "]"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"d\[Chi]", "=", 
   RowBox[{"D", "[", 
    RowBox[{"\[Chi]", ",", "t"}], "]"}]}], ";"}]}], "Input",
 CellChangeTimes->{{3.513533323577435*^9, 3.513533331092033*^9}, {
  3.513533381181343*^9, 3.513533384041068*^9}, {3.513534180527118*^9, 
  3.513534186497912*^9}, {3.513534242697953*^9, 3.513534243136149*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"\[GothicCapitalA]", "=", 
   RowBox[{"D", "[", 
    RowBox[{
     RowBox[{"N", "[", 
      RowBox[{"Linearize", "[", 
       RowBox[{
        RowBox[{"Flatten", "[", "\[ScriptF]", "]"}], ",", 
        RowBox[{"Flatten", "[", "\[Chi]", "]"}], ",", "xi"}], "]"}], "]"}], 
     ",", 
     RowBox[{"{", 
      RowBox[{"Flatten", "[", "\[Chi]", "]"}], "}"}]}], "]"}]}], 
  ";"}]], "Input",
 CellChangeTimes->{{3.543864883780608*^9, 3.5438648864997635`*^9}, {
   3.5438649195726557`*^9, 3.5438649605489993`*^9}, 3.5438651150618367`*^9, {
   3.5441056621055346`*^9, 3.5441057455553074`*^9}, {3.5441057999554186`*^9, 
   3.5441058253548717`*^9}, {3.5441893073567133`*^9, 
   3.5441893130920415`*^9}, {3.5441893467539673`*^9, 3.544189364153962*^9}, 
   3.5442075320304575`*^9, 3.5445263477964106`*^9, 3.5445269932473283`*^9}],

Cell[BoxData[
 RowBox[{
  RowBox[{"\[GothicCapitalB]", "=", 
   RowBox[{"N", "[", 
    RowBox[{"\[ScriptG]", "/.", 
     RowBox[{
      RowBox[{"(", 
       RowBox[{
        RowBox[{
         RowBox[{"\[Chi]", "[", 
          RowBox[{"[", 
           RowBox[{"#", ",", "1"}], "]"}], "]"}], "\[Rule]", 
         RowBox[{"xi", "[", 
          RowBox[{"[", "#", "]"}], "]"}]}], "&"}], ")"}], "/@", 
      RowBox[{"Range", "[", 
       RowBox[{"1", ",", 
        RowBox[{"2", "ndof"}]}], "]"}]}]}], "]"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.54300906925751*^9, 3.5430090857254524`*^9}, {
   3.5430091338622055`*^9, 3.5430091432617435`*^9}, {3.5430094847742767`*^9, 
   3.543009554557268*^9}, {3.5430096122205663`*^9, 3.543009635293886*^9}, {
   3.543009701360665*^9, 3.5430097442891197`*^9}, {3.5430098173042965`*^9, 
   3.5430098221535735`*^9}, {3.543144082911124*^9, 3.5431440866483383`*^9}, {
   3.543144163815752*^9, 3.543144167142942*^9}, {3.543147568936514*^9, 
   3.5431476218675413`*^9}, 3.5431484477207775`*^9, {3.5431498701781373`*^9, 
   3.543149870299144*^9}, 3.543337265560095*^9, {3.543338700965195*^9, 
   3.5433387625247164`*^9}, {3.5438637128536353`*^9, 
   3.5438637131416516`*^9}, {3.5438649751118317`*^9, 3.543865012628978*^9}, {
   3.5438650498931093`*^9, 3.5438651116776433`*^9}, {3.544105755280864*^9, 
   3.544105772057823*^9}, {3.544189481889696*^9, 3.5441894954944744`*^9}, {
   3.5442076320471783`*^9, 3.5442076334222565`*^9}, {3.5442083561195927`*^9, 
   3.5442083567996316`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"\[GothicCapitalC]", "=", 
   RowBox[{
    RowBox[{"D", "[", 
     RowBox[{
      RowBox[{"Linearize", "[", 
       RowBox[{
        RowBox[{"Flatten", "[", 
         RowBox[{"{", 
          RowBox[{"ya1", ",", "ya2"}], "}"}], "]"}], ",", 
        RowBox[{"Flatten", "[", "\[Chi]", "]"}], ",", "xi"}], "]"}], ",", 
      RowBox[{"{", 
       RowBox[{"Flatten", "[", "\[Chi]", "]"}], "}"}]}], "]"}], "//", "N"}]}],
   ";"}]], "Input",
 CellChangeTimes->{{3.543008199567767*^9, 3.5430082426512313`*^9}, {
   3.543008309084031*^9, 3.543008363819162*^9}, {3.5430084195893517`*^9, 
   3.5430085382601395`*^9}, {3.5430085869179225`*^9, 3.5430085900281*^9}, {
   3.543008648732458*^9, 3.5430086675175323`*^9}, {3.5430089082453012`*^9, 
   3.543008911390481*^9}, {3.5431449339478006`*^9, 3.5431449362479324`*^9}, {
   3.5431463153188105`*^9, 3.5431463448475*^9}, {3.5431464215228853`*^9, 
   3.5431464364057364`*^9}, {3.5431464761110077`*^9, 3.543146477869108*^9}, {
   3.5431465514963193`*^9, 3.543146558306709*^9}, {3.5431476411036415`*^9, 
   3.543147645466891*^9}, 3.5431484454696484`*^9, {3.5431498613386316`*^9, 
   3.543149874898407*^9}, 3.543337269251306*^9, {3.5433387696781254`*^9, 
   3.5433387968466797`*^9}, {3.543865125974461*^9, 3.5438651363180523`*^9}, {
   3.5441057772391195`*^9, 3.5441057931140275`*^9}, {3.5441894257884874`*^9, 
   3.5441894277616005`*^9}, {3.544207537062745*^9, 3.544207603734559*^9}, {
   3.54420836043384*^9, 3.544208364080048*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"\[GothicCapitalD]", "=", 
   RowBox[{"ConstantArray", "[", 
    RowBox[{"0", ",", 
     RowBox[{"{", 
      RowBox[{"ndof", ",", "ndof"}], "}"}]}], "]"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.543149183165842*^9, 3.5431491951785293`*^9}, {
  3.544207715000923*^9, 3.5442077170060377`*^9}, {3.5442077598714895`*^9, 
  3.544207761249568*^9}, {3.5442083686793113`*^9, 3.544208369767373*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"statesubs", "=", 
   RowBox[{"Flatten", "[", 
    RowBox[{
     RowBox[{
      RowBox[{"{", 
       RowBox[{
        RowBox[{
         RowBox[{
          SubscriptBox["\[Theta]", "#"], "[", "t", "]"}], "\[Rule]", 
         RowBox[{"x", "[", "#", "]"}]}], ",", 
        RowBox[{
         RowBox[{
          RowBox[{
           SubscriptBox["\[Theta]", "#"], "'"}], "[", "t", "]"}], "\[Rule]", 
         RowBox[{"x", "[", 
          RowBox[{"#", "+", "ndof"}], "]"}]}]}], "}"}], "&"}], "/@", 
     RowBox[{"Range", "[", 
      RowBox[{"1", ",", "5"}], "]"}]}], "]"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.5431451384834995`*^9, 3.543145201154084*^9}, 
   3.5431484405723686`*^9, {3.5433388194739733`*^9, 3.5433388213280797`*^9}}],

Cell[BoxData[{
 RowBox[{
  RowBox[{"SetDirectory", "[", 
   RowBox[{
    RowBox[{"NotebookDirectory", "[", "]"}], "<>", 
    "\"\<\\\\build\\\\lsys\>\""}], "]"}], ";"}], "\n", 
 RowBox[{
  RowBox[{"Export", "[", 
   RowBox[{"\"\<ss.mat\>\"", ",", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"\"\<A\>\"", "\[Rule]", "\[GothicCapitalA]"}], ",", 
      RowBox[{"\"\<B\>\"", "\[Rule]", "\[GothicCapitalB]"}], ",", 
      RowBox[{"\"\<C\>\"", "\[Rule]", "\[GothicCapitalC]"}], ",", 
      RowBox[{"\"\<D\>\"", "\[Rule]", "\[GothicCapitalD]"}]}], "}"}], ",", 
    "\"\<LabeledData\>\""}], "]"}], ";"}]}], "Input",
 CellChangeTimes->{{3.543147690278454*^9, 3.543147848771519*^9}, 
   3.5431484431965184`*^9, {3.543149176640469*^9, 3.5431492570700693`*^9}, {
   3.544526373418876*^9, 3.5445263750519695`*^9}, {3.5445269972945595`*^9, 
   3.5445270024018517`*^9}}]
},
WindowSize->{1672, 923},
WindowMargins->{{Automatic, 0}, {Automatic, 0}},
ShowSelection->True,
FrontEndVersion->"8.0 for Microsoft Windows (64-bit) (November 7, 2010)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[579, 22, 322, 5, 31, "Input"],
Cell[904, 29, 180, 3, 30, "Output"]
}, Open  ]],
Cell[1099, 35, 483, 9, 72, "Input"],
Cell[1585, 46, 191, 4, 31, "Input"],
Cell[1779, 52, 801, 16, 52, "Input"],
Cell[2583, 70, 775, 19, 52, "Input"],
Cell[3361, 91, 475, 11, 52, "Input"],
Cell[3839, 104, 851, 19, 31, "Input"],
Cell[4693, 125, 1509, 30, 31, "Input"],
Cell[6205, 157, 1498, 28, 31, "Input"],
Cell[7706, 187, 426, 9, 31, "Input"],
Cell[8135, 198, 765, 21, 31, "Input"],
Cell[8903, 221, 858, 19, 52, "Input"]
}
]
*)

(* End of internal cache information *)
